{extend name="public:base" /}

{block name="style"}
<link rel="stylesheet" type="text/css" href="__INDEX__/css/public.css">
<link rel="stylesheet" type="text/css" href="__INDEX__/css/style.css">
<link rel="stylesheet" type="text/css" href="__INDEX__/css/responsive.css">
<link rel="shortcut icon" href="__INDEX__/images/favorite.ico">
<link rel="stylesheet" type="text/css" href="__COMMON__/css/style.css">
<style type="text/css">
    .proceeds-tab{width: 100%;height: 40px;}
   #list{    overflow: hidden;
    margin-top: 10px;}
    .proceeds-tab .li{float: left;width: 20%;  cursor: pointer;}
    .proceeds-tab .li span{font-size: 0.9em;line-height: 40px;text-align: center;display: block;width: 100%;}
    .proceeds-tab .li .span-color{border-bottom: 2px solid #de484f;}
    .record li samp{float: right;}
    @media only screen and (min-width: 100px) and (max-width: 480px) {
       .tixn_record h2,.mingxi .ps,.mingxi em,.record li samp{font-size:12px;} 
    }
</style>

{/block}
{block name="html"}
{include file="index@public/main" /}
<div class="right_style">
    <h3 class="title_style"><em></em><span>收益记录</span></h3>
<div class="record tixn_record mingxi">
    <h1 class="h1">收益明细</h1>

    <div class="proceeds-tab">

        <div class="li"><span onclick="proceedsType(this,1)" class="{$type == 1 ? 'span-color' : ''}">消费提成</span></div>
        <div class="li"><span onclick="proceedsType(this,2)" class="{$type == 2 ? 'span-color' : ''}">绩效奖</span></div>
        <div class="li"><span onclick="proceedsType(this,3)" class="{$type == 3 ? 'span-color' : ''}">管理奖</span></div>
        <div class="li"><span onclick="proceedsType(this,4)" class="{$type == 4 ? 'span-color' : ''}">平级奖</span></div>
        <div class="li"><span onclick="proceedsType(this,5)" class="{$type == 5 ? 'span-color' : ''}">推荐奖</span></div>
        <div style="clear: both"></div>
        <input type="hidden" id="type" value="{$type}">
    </div>

    <ul id="list">
        <!--<li>-->
            <!--<h2>收益类型：<u>奖金币</u></h2>-->
            <!--<p class="ps">总金额：<u>+1000</u></p>-->
            <!--<em>时间：2018.12.20</em>-->
            <!--<samp>来源ID：123456</samp>-->
        <!--</li>-->

    </ul>
</div>
</div>
{/block}
{block name="javascript"}
<script src="__INDEX__/js/jquery-1.9.1.min.js"></script>
<script src="__INDEX__/js/public.js"></script>
<script src="__INDEX__/layer/layer.js"></script>

<script type="text/javascript">

    var pageNum = 1;
    var sign = true;

    $(function(){

        getListFuc();

        $(window).scroll(function() {

            if ($(window).scrollTop() == $(document).height() - $(window).height() && $(window).scrollTop() > 0 ) {

                pageNum++;
                if(sign){
                    sign = false;
                    getListFuc();
                }
            }
        });

    });

    function getListFuc(){
        var type = $("#type").val();
        $.ajax({
            type: 'POST',
            url: '{:url("Proceeds/ajax_list")}',
            dataType: 'json',
            data: {type:type,pageNum:pageNum},
            success: function (data) {
                console.log(data);
                if( data.result == 0 ){
                    var da = data.msg;
                    var html = "";
                    for(var i=0; i<da.length; ++i){
                        html += '<li>';
                        html += '<h2>收益类型：<u>'+da[i].typeName+'</u></h2>';
                        html += '<p class="ps">总金额：<u>+'+da[i].money+'</u></p>';
                        html += '<em>时间：'+da[i].time+'</em>';
                        if( da[i].source_id != 0){
                            html += '<samp>来源ID：'+da[i].source_id+'</samp>';
                        }
                        html += '</li>';
                    }
                    $("#list").append(html);
                    sign = true;
                }else{
                    $("#list").append('<p style="width: 100%;line-height: 50px;text-align: center;color: #5e5e5e">没有更多了</p>');
                }
            }
        });
    }

    function proceedsType(obj,type){
        var c = $(obj).attr("class");
        if( c == "span-color" ){
            return true;
        }
        if( type == 1 ){
            location.href = '{:url("Proceeds/index",array("type"=>1))}';
        }else if( type == 2 ){
            location.href = '{:url("Proceeds/index",array("type"=>2))}';
        }else if( type == 3 ){
            location.href = '{:url("Proceeds/index",array("type"=>3))}';
        }else if( type == 4 ){
            location.href = '{:url("Proceeds/index",array("type"=>4))}';
        }else if( type == 5 ){
            location.href = '{:url("Proceeds/index",array("type"=>5))}';
        }
    }


</script>

{/block}


